package com.ty.blog.service.blog.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ty.blog.common.utils.PageUtils;
import com.ty.blog.common.utils.Query;
import com.ty.blog.dao.ArticleDao;
import com.ty.blog.dto.req.ArticleEntityReq;
import com.ty.blog.entity.ArticleEntity;
import com.ty.blog.service.blog.ArticleService;
import com.ty.blog.service.blog.BaseService;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service("xBlogArticleService")
public class ArticleServiceImpl extends ServiceImpl<ArticleDao, ArticleEntity>
    implements ArticleService, BaseService<ArticleEntity, ArticleEntityReq> {

  @Override
  public PageUtils queryPage(Map<String, Object> params) {
    IPage<ArticleEntity> page =
        this.page(
            new Query<ArticleEntity, ArticleEntityReq>().getPage(params),
            new QueryWrapper<ArticleEntity>());

    return new PageUtils(page);
  }
}
